﻿<Window x:Class="LayoutPlanning.Views.LoadStationView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:LayoutPlanning.Views"
        xmlns:pt="http://propertytools.org/wpf"
        xmlns:interactivity="clr-namespace:Mvvm.UI.Interactivity;assembly=Mvvm"
        xmlns:eventToCommand="clr-namespace:Mvvm.UI.Behaviors.EventToCommand;assembly=Mvvm"
        xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
        mc:Ignorable="d" Style="{StaticResource ApplicationFonts}" 
        Title="LoadLayout" Height="676.045" Width="664.345"
         DataContext="{Binding Stations, Source={StaticResource Locator}}">
    <Grid>
        <ListBox ItemsSource="{Binding Stations}" Margin="0,47,0,0">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel  Orientation="Horizontal" Height="150">
                        <TextBlock Margin="3"  Text="Name:" />
                        <TextBox Margin="3"   Width="100" FontSize="15" VerticalAlignment="Top" Text="{Binding Name}" />
                        <Viewbox Margin="3"    Width="150" Height="100" Stretch="UniformToFill">
                            <StackPanel >
                                <Grid Background="{Binding Background}" Visibility="{Binding ControlType, Converter={StaticResource TaskTypeToVisability}, ConverterParameter=Custom}" >
                                    <ContentControl  Background="{Binding NormalColor}"  Content="{Binding CustomControl.Element}"  />
                                </Grid>
                                <Rectangle x:Name="Rectangle" Visibility="{Binding ControlType, Converter={StaticResource TaskTypeToVisability}, ConverterParameter=Square}" Width="{Binding SizeX}" Height="{Binding SizeY}" Fill="{Binding NormalColor}" StrokeThickness="5" Stroke="{DynamicResource ButtonPressedBackground}" Opacity="70" >
                                    <interactivity:Interaction.Behaviors>
                                        <eventToCommand:EventToCommand EventName="IsVisibleChanged" Command="{Binding VisibleChanged}" PassEventArgsToCommand="True" CommandParameter="{Binding ElementName=Rectangle, Mode=OneWay}">

                                        </eventToCommand:EventToCommand>
                                    </interactivity:Interaction.Behaviors>
                                </Rectangle>
                                <ed:Arc x:Name="Arc"  Visibility="{Binding ControlType, Converter={StaticResource TaskTypeToVisability}, ConverterParameter=Circle}"  ArcThickness="100000" StartAngle="0" EndAngle="360"   StrokeThickness="10" Fill="{Binding NormalColor}" Opacity="70">
                                    <interactivity:Interaction.Behaviors>
                                        <eventToCommand:EventToCommand EventName="IsVisibleChanged" Command="{Binding VisibleChanged}" PassEventArgsToCommand="True" CommandParameter="{Binding ElementName=Arc, Mode=OneWay}">

                                        </eventToCommand:EventToCommand>
                                    </interactivity:Interaction.Behaviors>
                                </ed:Arc>
                            </StackPanel>
                        </Viewbox>
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal">
                                <Button  Margin="3" VerticalAlignment="Center" HorizontalAlignment="Right" Command="{Binding ImportGrafics}" Content="Import new grafics" />
                                <Button Margin="3" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Load" Command="{Binding Main.LoadStation, Source={StaticResource Locator}}" CommandParameter="{Binding}" />
                            </StackPanel>
                            <pt:ColorPicker Height="22" SelectedColor="{Binding NormalColorString}"></pt:ColorPicker>
                            <Button Content="{Binding SyncedText}" Command="{Binding SaveUpdate}"></Button>
                            <StackPanel Orientation="Horizontal">
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="Grafical Form"></TextBlock>
                                    <RadioButton  Content="Square" IsChecked="{Binding ControlType, Mode=OneWay, Converter={StaticResource ControlTypeChecked}, ConverterParameter=Square }" HorizontalAlignment="Left"  VerticalAlignment="Top">
                                        <interactivity:Interaction.Behaviors>
                                            <eventToCommand:EventToCommand  EventName="Checked" Command="{Binding ChangeShape}" CommandParameter="Square" ></eventToCommand:EventToCommand>
                                        </interactivity:Interaction.Behaviors>
                                    </RadioButton>
                                    <RadioButton Content="Circle" HorizontalAlignment="Left"  VerticalAlignment="Top" IsChecked="{Binding ControlType, Mode=OneWay, Converter={StaticResource ControlTypeChecked}, ConverterParameter=Circle }">
                                        <interactivity:Interaction.Behaviors>
                                            <eventToCommand:EventToCommand  EventName="Checked" Command="{Binding ChangeShape}" CommandParameter="Circle" ></eventToCommand:EventToCommand>
                                        </interactivity:Interaction.Behaviors>
                                    </RadioButton>
                                    <RadioButton  Content="Custom" HorizontalAlignment="Left"  VerticalAlignment="Top" IsChecked="{Binding ControlType, Mode=OneWay, Converter={StaticResource ControlTypeChecked}, ConverterParameter=Custom }">
                                        <interactivity:Interaction.Behaviors>
                                            <eventToCommand:EventToCommand  EventName="Checked" Command="{Binding ChangeShape}" CommandParameter="Custom" ></eventToCommand:EventToCommand>
                                        </interactivity:Interaction.Behaviors>
                                    </RadioButton>
                                </StackPanel>
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Grid.Row="0" HorizontalAlignment="Left"  TextWrapping="Wrap" Text="Size X"
                	        Height="20" VerticalAlignment="Top"  />
                                    <TextBlock Grid.Row="0" HorizontalAlignment="Left"  TextWrapping="Wrap" Text="Size Y"
                	        Height="20" VerticalAlignment="Top"  />
                                </StackPanel>
                                <StackPanel Orientation="Vertical">
                                    <pt:SpinControl Value="{Binding SizeX}" Maximum="100000000" HorizontalAlignment="Left"
                	    Width="65" VerticalAlignment="Top" Height="20" >
                                        <TextBox Text="{Binding SizeX, StringFormat=0.##}" BorderThickness="0" HorizontalContentAlignment="Right"/>
                                    </pt:SpinControl>
                                    <pt:SpinControl Value="{Binding SizeY}" HorizontalAlignment="Left" Maximum="100000000" 
                	    Width="65" Height="21" VerticalAlignment="Top"    >
                                        <TextBox Text="{Binding SizeY, StringFormat=0.##}" BorderThickness="0" HorizontalContentAlignment="Right"/>
                                    </pt:SpinControl>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>

                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Label  Content="Load Station" Margin="7,11" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        <Button Content="Create New Station"  Command="{Binding CreateNewStation}" HorizontalAlignment="Right" Margin="0,11,5,0" VerticalAlignment="Top"   />

    </Grid>
</Window>
